@import "@/assets/style/variables.scss";

$baseCls: common-drawer;

.#{$baseCls} {
  position: fixed;
  background-color: white;
  overflow: hidden;
  z-index: -1;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-in-out;
  box-sizing: border-box;

  &.show {
    z-index: 200;
    opacity: 1;
    visibility: visible;
  }

  &.#{$baseCls}--left {
    left: 0;
    top: 0;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    transform: translateX(-20%);
    display: flex;
    flex-flow: column nowrap;
    padding-bottom: $safe-area;
  }
  &.#{$baseCls}--left > &-content {
    flex: 1;
    overflow: auto;
  }
  &.#{$baseCls}--left.show {
    transform: translateX(0);
  }

  &.#{$baseCls}--right {
    right: 0;
    top: 0;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    transform: translateX(20%);
    display: flex;
    flex-flow: column nowrap;
    padding-bottom: $safe-area;
  }
  &.#{$baseCls}--right > &-content {
    flex: 1;
    overflow: auto;
  }
  &.#{$baseCls}--right.show {
    transform: translateX(0);
  }

  &.#{$baseCls}--top {
    top: 0;
    left: 0;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    transform: translateY(-20%);
    padding-bottom: 16px;
  }
  &.#{$baseCls}--top.show {
    transform: translateY(0);
  }

  &.#{$baseCls}--bottom {
    padding-bottom: $safe-area;
    left: 0;
    bottom: 0;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    transform: translateY(20%);
  }
  &.#{$baseCls}--bottom.show {
    transform: translateY(0);
  }

  &-top {
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-weight: 500;
    font-size: 18px;
    line-height: 18px;
    color: $text-color;
  }

  &-logo-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0.6px solid #e5e8ef;
    margin-right: 8px;
  }

  &-logo {
    width: 22px;
  }

  &-back-wrapper {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(22, 24, 35, 0.05);
  }
  &-back {
    width: 22px;
    height: 22px;
  }

  &-title {
    padding: 14px 16px;
    font-weight: 500;
    font-size: 17px;
    line-height: 24px;
    color: $text-color;
  }

  &-content {
    padding: 0 16px;
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: rgba($text-color, 0.75);
  }

  &-bottom {
    display: flex;
    padding: 16px 16px 0 16px;
  }

  &-btn {
    position: relative;
    flex: 1;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 15px;
    line-height: 21px;
    color: $text-color;
    border-radius: 2px;
    border: 0.5px solid rgba($text-color, 0.5);
  }

  &-btn.primary {
    color: white;
    background: $primary-color;
    border-color: $primary-color;
  }

  &-btn + &-btn {
    margin-left: 8px;
  }

  &-close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 28px;
    height: 28px;
    background-color: rgba(22, 24, 35, 0.05);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    &-icon {
      height: 22px;
      width: 22px;
    }
  }
}

.#{$baseCls}-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: rgba(#000000, 0.6);
  z-index: -1;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;

  &.show {
    z-index: 100;
    opacity: 1;
    visibility: visible;
  }
}
